<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="my" tagdir="/WEB-INF/tags"%>

<!DOCTYPE html>
<html>
<head>
<my:head
	title='Кристинкин магазинчик: Редактирование <c:out
		value="${item.name}" default="неизвестный товар" />' />
</head>

<body>
	<my:header/>
	<my:nav/>

	<div id="pageContent">
		<c:url value="image" var="itemImageUrl">
			<c:param name="id" value="${item.mainImage.id}" />
			<c:param name="width" value="200" />
			<c:param name="height" value="200" />
		</c:url>

		<c:url value="item_modify" var="itemModifyUrl">
			<c:param name="id" value="${item.id}" />
		</c:url>

		<div id="item_image_block">
			<div class="thumbnails">
				<img alt="item image" src="${itemImageUrl}" />
			</div>
			<p>Размер:</p>
			<table>
				<tbody>
					<tr>
						<td>Ширина:</td>
						<td>${item.width} см.</td>
					</tr>

					<tr>
						<td>Высота:</td>
						<td>${item.height} см.</td>
					</tr>


					<tr>
						<td>Глубина:</td>
						<td>${item.depth} см.</td>
					</tr>

				</tbody>
			</table>
		</div>

		<div id="item_description">
			<h1>${item.name}</h1>
			<p>
				<c:out value="${item.description}" />
			</p>

			<div class="order_block">
				<div class="goods_price">
					<p>
						<span>${item.cost}</span> рублей
					</p>
				</div>

				<div class="goods_order">
					<form action="order" method="post">
						<input type="hidden" name="id" value="${item.id}"> <input
							type="submit" value="Заказать">
					</form>

					<c:if test='<%=request.isUserInRole("Kristinkin")%>'>
						<a href="${itemModifyUrl}">Изменить</a>

						<form action='<c:url value="item_modify"/>' method="post">
							<input type="hidden" name="id" value="${item.id}"> <input
								type="hidden" name="remove" value="true"> <input
								type="submit" value="Удалить">
						</form>
					</c:if>
				</div>
			</div>

			<div id="image_gallery">
				<c:forEach var="image" items="${item.images}">
					<div class="item_image"></div>
				</c:forEach>
			</div>
		</div>
	</div>

	<my:footer/>
</body>
</html>